import * as constant from './constant'
import { fromJS } from 'immutable'
const defaultState = fromJS({
    focused:false,
    list:[],
    page:1,
    localpage:1,
    mouseIn:false
})
export default((state=defaultState,action) => {
  switch(action.type){
     case constant.SEARCH_FOCUS:
      return  state.set('focused', true);
     case constant.SEARCH_BLUR:
      return  state.set('focused', false);
    case constant.MOUSE_ENTER:
     return  state.set('mouseIn', true)
    case constant.MOUSE_LEAVE:
     return state.set('mouseIn', false)
    case constant.CHANGE_PAGE:
      return state.set('page', action.page)
    case constant.CHANGE_LIST:
      return state.set('list', action.data).set('localpage', action.localpage)
    default:
     return state;
  }
})